class PollsController < ApplicationController
  def index
    list
    render :action => 'list'
  end

  # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
  verify :method => :post, :only => [ :destroy, :create, :update ],
         :redirect_to => { :action => :list }

  def list
    @polls_pages, @polls = paginate :polls, :per_page => 10
  end

  def show
    @polls = Polls.find(params[:id])
  end

  def new
    @polls = Polls.new
  end

  def create
    @polls = Polls.new(params[:polls])
    if @polls.save
      flash[:notice] = 'Polls was successfully created.'
      redirect_to :action => 'list'
    else
      render :action => 'new'
    end
  end

  def edit
    @polls = Polls.find(params[:id])
  end

  def update
    @polls = Polls.find(params[:id])
    if @polls.update_attributes(params[:polls])
      flash[:notice] = 'Polls was successfully updated.'
      redirect_to :action => 'show', :id => @polls
    else
      render :action => 'edit'
    end
  end

  def destroy
    Polls.find(params[:id]).destroy
    redirect_to :action => 'list'
  end
  
  def show_section
		
		questions= Question.find(:all)
		@i=0 # This is de ID counter for the intesifiers
		render :partial =>"questions/question",:layout=> "polls",:collection =>questions
		# render_partial_collection("questions/answer_form", @questions )
  end
  
end
